﻿using L.UI.Base;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MainPanel : BasePanel
{
    private void Start()
    {
        AddOnClickListener("SpaceShowButton", OpenSpaceShow);
        AddOnClickListener("GlobalShowButton", OpenGlobalShow);
        AddOnClickListener("PartShowButton", OpenPartShow);
        AddOnClickListener("DataShowButton", OpenDataShow);
        AddOnClickListener("CloseButton", CloseProcedure);
    }

    private void OpenDataShow()
    {
        //UIManager.Instance.CloseAllUI();
        //OpenUI(UIPanelType.MainPanel);
        //OpenUI(UIPanelType.DataPanel);
    }

    private void OpenPartShow()
    {
        if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "PartScene")
        {
            return;
        }
        UIManager.Instance.CloseAllUI();
        OpenUI(UIPanelType.MainPanel);
        OpenUI(UIPanelType.PartPanel);
        LoadScene.Instance.LoadTheScene("PartScene");
    }

    private void OpenGlobalShow()
    {
        //UIManager.Instance.CloseAllUI();
        //OpenUI(UIPanelType.MainPanel);
        //OpenUI(UIPanelType.GlobalPanel);
    }

    private void OpenSpaceShow()
    {
        if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "SpaceScene")
        {
            return;
        }
        UIManager.Instance.CloseAllUI();
        OpenUI(UIPanelType.MainPanel);
        OpenUI(UIPanelType.SpacePanel);
        LoadScene.Instance.LoadTheScene("SpaceScene");
    }

    
}
